<template>
  <el-dialog :visible="isPop" title="请选择下载的工资项" width="300px" @close="onClose" append-to-body>
    <el-checkbox-group v-model="checked">
      <el-checkbox v-for="item in attribute" :key="item.id" :label="item.namePy">{{ item.name }}</el-checkbox>
    </el-checkbox-group>
    <template #footer>
      <el-button @click="onClose">取消</el-button>
      <el-button type="primary" @click="onClick">确定</el-button>
    </template>
  </el-dialog>
</template>
<script>
export default {
  name: "importOptionsPop",
  props: {
    isPop: {
      type: Boolean,
      default: false
    },
    attribute: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      checked: []
    };
  },
  methods: {
    onClose() {
      this.$emit("update:isPop", false);
    },
    onClick() {
      this.onClose();
      this.$emit("affirm", this.checked);
    }
  },
  mounted() {
    console.log(this.attribute);
  }
};
</script>
<style lang="less" scoped>
.el-checkbox-group {
  margin: 10px 0 15px;
  display: flex;
  flex-direction: column;
  .el-checkbox {
    margin: 5px 0;
  }
}
</style>
